package cn.ywang.pattern;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @author BeatificWang
 * @date 2019/3/21 23:44
 */
@Component
@Aspect("my(execution(* invokeGet()))")
public class MyAspect {

	private int invocations = 0;

	public int getInvocations() {
		return this.invocations;
	}

	@Around("execution(* invokeGet())")
	public int changeAge(ProceedingJoinPoint pjp) throws Throwable {
		System.out.println("调用次数：" + this.invocations);
		return this.invocations++;
	}


}
